﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GetRewardButton : MonoBehaviour
{
    public Text CoinsText;
    public Text RewardTips;
   public void OnClickGetRewardBtn()
    {
        AdManager.single.ShowVideo(
            ()=> {
            PlayerPrefs.SetInt("Coins",PlayerPrefs.GetInt("Coins")+100000);
            CoinsText.text = PlayerPrefs.GetInt("Coins").ToString();
            RewardTips.text = "获取金币成功";
            StartCoroutine(ShowTips());},
            () =>
            {
                RewardTips.text = "获取金币失败";
                StartCoroutine(ShowTips());
            }
        );
    }
    IEnumerator ShowTips()
    {
        RewardTips.gameObject.SetActive(true);
        yield return new WaitForSeconds(1.5f);
        RewardTips.gameObject.SetActive(false);
    }
}
